package com.example.android.story.Utils;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

/**
 * Created by android on 18-5-21.
 */

@Dao
public interface UserDao {
    @Query("select * from _user")
    public LiveData<List<User>> getAllUsersLiveData();

    @Query("select * from _user")
    public List<User> getAllUsers();

    @Query("select * from _user where username=:username")
    public LiveData<User> getUserLiveData(String username);

    @Query("select * from _user where username=:username")
    public User getUser(String username);

    @Update
    public void updateUser(User ... user);

    @Delete
    public void deleteUser(User ... user);

    @Insert
    public void insertUser(User ... user);
}
